-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid deprecated 'U' mode when opening files #2187
Conversation
IIRC, there was some pain around trying this previously. |
Do you have any information on the previous attempt? If an edge case does exist, it doesn't look to be captured in a test. |
I think it's from the pr around 9b35a45 Looking around that era, it does look like the U was just carried forward at that time, rather than being added then. |
Looking at the EPS spec, it looks like Python's "universal new lines" will always be incorrect. From the spec:
Python's universal newlines does not handle the '\n\r' case. Therefore, I think the I have updated the PR with this chage as well as updated the tests to now test against all combinations of line endings. |
As a nice side effect, this change also fixes the orphaned open file that was never explicitly closed. Thus leading to fewer |
Rebased to latest master. |
I suggest we merge this after this quarterly release so it has some time to sit in master. |
Codecov Report
@@ Coverage Diff @@
## master #2187 +/- ##
==========================================
- Coverage 84.03% 83.28% -0.76%
==========================================
Files 170 168 -2
Lines 23776 22616 -1160
Branches 2825 2795 -30
==========================================
- Hits 19981 18836 -1145
+ Misses 3795 3780 -15
Continue to review full report at Codecov.
|
Instead, use PSFile() wrapper to handle all newline in the EPS spec. Update line ending tests to handle all combinations of '\n' and '\r'. Fixes warning "DeprecationWarning: 'U' mode is deprecated" in tests.
Rebased to resolve merge conflicts. |
Instead, use io.open() wrapper to handle universal newlines for all Python versions.(Different approach taken, see below.)Fixes warning "DeprecationWarning: 'U' mode is deprecated" in tests.